package com.yutian.example.demo.common.exceptions;


import com.yutian.example.demo.common.vo.HttpResponse;

/**
 * 自定义业务异常
 */
public class MyServiceException extends RuntimeException {

    private int code;

    private Object[] params;

    public MyServiceException(int code, String errMsg, Object[] params, Throwable ex) {
        super(errMsg, ex);
        this.code = code;
        this.params = params;
    }

    public MyServiceException(int code, String errMsg, Throwable ex) {
        super(errMsg, ex);
        this.code = code;
        this.params = null;
    }

    public MyServiceException(int code, String errMsg) {
        super(errMsg);
        this.code = code;
        this.params = null;
    }

    public MyServiceException(String errMsg, Object[] params, Throwable ex) {
        super(errMsg, ex);
        this.code = HttpResponse.CODE_FAIL_COMMON;
        this.params = params;
    }

    public MyServiceException(String errMsg, Throwable ex) {
        super(errMsg, ex);
        this.code = HttpResponse.CODE_FAIL_COMMON;
        this.params = null;
    }

    public MyServiceException(String errMsg, Object[] params) {
        super(errMsg);
        this.code = HttpResponse.CODE_FAIL_COMMON;
        this.params = params;
    }

    public MyServiceException(String errMsg) {
        super(errMsg);
        this.code = HttpResponse.CODE_FAIL_COMMON;
        this.params = null;
    }


    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public Object[] getParams() {
        return params;
    }

    public void setParams(Object[] params) {
        this.params = params;
    }
}
